<div class="pageContent">
    <form method="post" action="${rc.getContextPath()}/manage/safetyinventroy/saveSafetyinventroy" class="pageForm required-validate" onsubmit="return validateCallback(this, dialogAjaxDone)">
        <input type="hidden" name="navTabId" value="${navTabId!''}" />
        <div class="pageFormContent" layoutH="58">
            <fieldset>
                <dl class="notnormal">
                    <dt><@label key="material.C,colon">物料：</@label></dt>
                    <dd>
                        <input class="required look" id="safetyinventroyMaterialLookup.materialCode" name="materialCode" type="text" postField="materialCode" suggestFields="materialCode,materialText"
                        suggestUrl="${rc.getContextPath()}/manage/material/componentSuggest" lookupGroup="safetyinventroyMaterialLookup" />
                        <a class="btnLook" href="${rc.getContextPath()}/manage/material/componentLookUp?lookupType=radio" rel="safetyinventroyMateriall_dialog" title="<@label key='select.C,materialCode.C'>选择物料</@label>" lookupGroup="safetyinventroyMaterialLookup" ></a>
                    </dd>
                </dl>
                <dl>
                    <dt><@label key="materialText.C,colon">物料描述：</@label></dt>
                    <dd>
                        <input id="safetyinventroyMaterialLookup.materialText"   readonly="readonly" type="text"/>
                    </dd>
                </dl>
                <dl>
                    <dt><@label key="warehouse.C,colon">仓库：</@label></dt>
                    <dd>
                        <select  name="warehouseCode" class="required"
                         postField="warehousCode" refUrl="${rc.getContextPath()}/manage/storageLocation/getStorageLocation">                
                            <option value=""><@label key='selected_first.C'>请选择</@label></option>
                            <#if warehouses??>
                                <#list warehouses as warehouse>
                                    <option value="${warehouse.warehouseCode!''}" >${warehouse.warehouseText!''}</option>
                                </#list>
                            </#if>
                        </select>
                    </dd>
                </dl>
                <dl id="storageLocation_combox">
                    <dt><@label key="storageLocation.C,colon">库位：</@label></dt>
                    <dd>
                        <select name="storageLocationCode">
                            
                        </select>
                    </dd>
                </dl>
                <dl>
                    <dt><@label key="safetyInventory.C,colon">安全库存：</@label></dt>
                    <dd>
                        <input name="safetyInventory" class="required digits number integer" min="1"  maxlength="15"  type="text" />
                    </dd>
                </dl>
                <dl>
                    <dt><@label key="maxInventory.C,colon">最大库存：</@label></dt>
                    <dd>
                        <input name="maxInventory" class="digits"  maxlength="15" type="text"/>
                    </dd>
                </dl>
            </fieldset>
        </div>
        <div class="formBar">
        <ul>
            <li><div class="buttonActive"><div class="buttonContent"><button type="submit"><@label key="save.B">保存</@label></button></div></div></li>
            <li>
                <div class="buttonActiveGrey"><div class="buttonContent"><button type="button" class="close"><@label key="cancel.B">取消</@label></button></div></div>
            </li>
        </ul>
       </div>
    </form>
</div>
<script>
    $(function(){
        $("dl#storageLocation_combox", $.pdialog.getCurrent()).css("display","none");
        $("select[name='warehouseCode']", $.pdialog.getCurrent()).change(function(){
            var warehouseCode = $(this).val();
            $.DWZajax({
                url:hostUrl +"/storageLocation/getStorageLocation",
                data:{'warehouseCode':warehouseCode},
                callback:function(data){
                    if(data && data.length > 0){
                        var options = "<option value='' ><@label key='select.C'>请选择</@label></option>";
                        for(var i=0; i<data.length; i++){
                            options += "<option value="+data[i].storageLocationCode+">"+data[i].storageLocationText+"</option>";
                        }
                        $("select[name='storageLocationCode']", $.pdialog.getCurrent()).html(options);
                        $("dl#storageLocation_combox").show();
                    }else{
                        $("dl#storageLocation_combox").hide();
                        $("select[name='storageLocationCode']", $.pdialog.getCurrent()).html("");
                    }
                }
            });
        })
    })
</script>